public class lk1759 {
    public static void main(String[] args) {
        String a="abbcccaa";
        System.out.println(fuck(a));
        
    }
    public static int fuck(String s){
        int n=s.length();
        int mod=1000000007;
        long end=0l;
        
        if(n==1){
            return 1;
        }
        int count=1;
        for(int i=0;i<n;i++){
            if(i<n-1){
                if(s.charAt(i)==s.charAt(i+1)){
                    count++;
                }
                if(s.charAt(i)!=s.charAt(i+1)){
                    end+=(long)(1+count)*count/2;
                    count=1;
                }
            }
            
            if(i==n-1&&s.charAt(i)!=s.charAt(i-1)){
                end++;
            }
            if(i==n-1&&s.charAt(i)==s.charAt(i-1)){
                end+=(long)(1+count)*count/2;
                count=1;
            }
            
        }
        return (int)(end%mod);
    }
}
